package com.xbjtech.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xbjtech.model.StoreUser;
import com.xbjtech.model.StoreUserExample;
import com.xbjtech.service.StoreUserService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;


@Controller
public class MapController {
	@Autowired
	StoreUserService storeUserService;
	
	@RequestMapping("/map/store")
	public String mapStore(Model model) {
		StoreUserExample storeUserExample = new StoreUserExample();
		storeUserExample.createCriteria().andDeletedEqualTo(0);
		List<StoreUser> storeList = storeUserService.selectStoreList(storeUserExample);
		ObjectMapper mapper=new ObjectMapper();
		String storeListJson=null;
		try {
			storeListJson = mapper.writeValueAsString(storeList);
			//System.out.println(storeListJson);
		} catch (JsonProcessingException e) {
			e.printStackTrace();
		}
		model.addAttribute("storeListJson",storeListJson);
		return "map/mapstore";
	}
	
	@RequestMapping("/map/storeinput")
	public String storeInput() {
		return "store/storeinput";
	}
}













